{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">

                        <div class="x_panel">
                            <div class="x_title">
                                <h2>会员卡使用记录</h2>
                                <a style="float: right" href="{:url('card')}"
                                   class="btn btn-success btn-sm">使用会员卡</a>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">
                                <form name="form" id="form" method="get" action="">
                                <div class="title_left">
                                    <div class="col-md-11 col-sm-3 col-xs-12 form-group pull-left top_search">
                                        <div class="input-group" style="float: left;margin: 0 20px;">

                                            <select name="is_agree" id="status1" class="select2_single1" style="width: 200px;"
                                                    tabindex="-1">
                                                <option value="0">- 全部 -</option>
                                                <option value="1" {eq name=':input("is_agree")' value='1' }selected{/eq}>未同意</option>
                                                <option value="2" {eq name=':input("is_agree")' value='2' }selected{/eq}>已同意</option>
                                            </select>

                                        </div>
                                        <div class="input-group" style="float: left;margin: 0 20px;">

                                            <select name="shop_id" id="status1" class="select2_single1" style="width: 200px;"
                                                    tabindex="-1">
                                                <option value="0">- 全部门店 -</option>
                                                {volist name="$shop_list" id="item"}
                                                <option value="{$item.id}" {eq name=':input("shop_id")' value='$item.id' }selected{/eq}>{$item.shop_title}</option>
                                                {/volist}
                                            </select>

                                        </div>

                                        <div class="input-group" style="float: left;margin: 0 20px;">

                                            <select name="card_type" id="status1" class="select2_single1" style="width: 200px;"
                                                    tabindex="-1">
                                                <option value="0">- 会员卡类型 -</option>
                                                <option value="1" {eq name=':input("card_type")' value='1' }selected{/eq}>年卡</option>
                                                <option value="2" {eq name=':input("card_type")' value='2' }selected{/eq}>次卡</option>

                                            </select>

                                        </div>
                                        <div class="input-group" style="float: left;margin: 0 20px;">

                                            <select name="single_id" id="status1" class="select2_single1" style="width: 200px;"
                                                    tabindex="-1">
                                                <option value="0">- 服务类型 -</option>
                                                {volist name=":db('single')->where('auding_status',2)->where('is_delete',1)->where('parent_id',0)->select()" id="item"}
                                                <option value="{$item.id}" {eq name=':input("single_id")' value='$item.id' }selected{/eq}>{$item.cat_name}</option>
                                                {/volist}

                                            </select>

                                        </div>
                                        <div class="input-group" style="float: left;margin: 0 20px;">
                                            <input type="text" class="form-control" name="interval_timer"
                                                   id="interval_timer"
                                                   style="width: 200px;"
                                                   placeholder="请选择时间区间..." value="{:input('interval_timer')}">
                                        </div>
                                        <div class="input-group">
                                            <input type="text" class="form-control" name="title"
                                                   placeholder="输入搜索内容..." value="{:input('title')}">
                                        </div>

                                    </div>
                                    <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索</button>
                                </div>
                                </form>
                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                            <!--<input type="checkbox" class="checkall"-->
                                            <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->

                                            <th>会员卡ID</th>
                                            <th>用户名称</th>
                                            <th>车牌号</th>
                                            <th>是否认证</th>
                                            <th>会员卡类型</th>
                                            <th>总次数-剩余次数</th>
                                            <th>消费门店</th>
                                            <th>服务人员</th>
                                            <th>服务提成</th>
                                            <th>服务分类</th>
                                            <th>服务内容</th>
                                            <th>是否同意</th>
                                            <th>服务时间</th>
                                            <th>打印提成</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="data"}
                                        <tr><td colspan="14"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        {volist name="data" id="item"}
                                        <tr >
                                            <td>{$item.card_id}</td>
                                            <td>{$item.username}</td>
                                            <td>
                                                {$item.car_number}
                                            </td>
                                            <td>
                                                {$item.is_certification_text}
                                            </td>
                                            <td>
                                                {$item.card_type}
                                            </td>
                                            <td>{$item.c}</td>
                                            <td>{$item.shop_title}</td>
                                            <td>{$item.shop_assignor_name}</td>
                                            <td>{$item.price}</td>
                                            <td>{$item.single_id}</td>
                                            <td>{$item.service_content}</td>
                                            <td>{$item.is_agree}</td>
                                            <td>{$item.create_time}</td>
                                            <td>
                                                <a {eq name="$item.is_agree" value="已同意"}href="{:url('shop/mc_table', ['id' => $item['order_id'],'table' =>1])}"{else/}onclick="dayin()"{/eq}
                                                   class="label label-success" style="margin-left: 10px;">
                                                    <span class="fa fa-pencil"></span>&nbsp;&nbsp;打印提成
                                                </a>

                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                    <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                <a type="button" class="btn btn-success" style="margin-top: 20px;" onclick="dcd()">用户会员卡使用记录</a>
                                <a type="button" class="btn btn-danger" style="margin-top: 20px;">用户会员卡消费 ({$number}) 次数 - ({$price}) 元</a>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!-- public -->
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<!-- daterangepicker -->
<script src="__STATIC__/js/datepicker/daterangepicker.js"></script>
<script type="text/javascript">
    // list
    $('[name="status"]').change(function(){
        //form.submit();
        $('form').submit();
    });
    function dayin() {
        layer.msg('用户未同意使用,无法打印');
    }

    $(document).ready(function () {
        // select2
        $(".select2_single1").select2({
            placeholder: "请选择分类",
            allowClear: true
        });
        $('#interval_timer').daterangepicker(null,
            function(start, end, label) {
//                console.log(start.toISOString(), end.toISOString(), label);
            });
    });
    function dcd(){
        var both = $('#interval_timer').val();
        var title = "{:input('title')}";
        var is_agree = "{:input('is_agree')}";
        var shop_id = "{:input('shop_id',0)}";
        var card_type = "{:input('card_type',0)}";
        var single_id = "{:input('single_id',0)}";
        window.location.href = "{:url('member_card_records')}?export=1&pages=100000&title="+title+'&shop_id='+shop_id+'&interval_timer=' + both+'&card_type='+card_type+'&single_id='+single_id+"&is_agree="+is_agree;
    }
</script>